﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Clandestine.Conversations;

namespace JibberJabber.PartDesigners
{
    public delegate void ToStringOutputUpdated(PartDesigner pdUpdated);

    public class PartDesigner : Form
    {
        public event ToStringOutputUpdated ToStringOutputUpdated = null;

        public PartDesigner()
            : base()
        {
            this.FormClosing += new FormClosingEventHandler(PartDesigner_FormClosing);
        }

        void PartDesigner_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                e.Cancel = true;
                this.Hide();
            }
        }

        internal void callToStringOutputUpdatedProgramDotCsHook()
        {
            if (ToStringOutputUpdated != null)
                ToStringOutputUpdated(this);
        }

        public virtual string StartXml
        {
            get { throw new NotImplementedException(); }
        }

        public virtual string EndXml
        {
            get { throw new NotImplementedException(); }
        }

        public virtual Type[] AllowedChildren
        {
            get { throw new NotImplementedException(); }
        }

        public virtual void NotifyChildrenUpdated() { }

        public List<PartDesigner> Children = new List<PartDesigner>();

        public TreeNode AssociatedNode = null;
    }
}
